<?php
/**
 * Created by PhpStorm.
 * User: 彭奇
 * Date: 2018/9/27
 * Time: 22:00
 */
try{
    $pdo = new PDO("mysql:dbname=test;host=127.0.0.1","root","");
    $pdo->exec("SET NAMES 'utf8';");
}catch (PDOException $e){
    echo "连接失败";
    var_dump($e);
}
$sql="SELECT * FROM pq_user";
$res=$pdo->query($sql);
echo "<table border='1'>";

echo "<tr>
            <th>id</th>
            <th>账号</th>
            <th>密码</th>
          </tr>";
foreach ($res as $row){
    echo "<tr>";
    echo "<td>{$row['id']}</td>";
    echo "<td>{$row['name']}</td>";
    echo "<td>{$row['pass']}</td>";
    echo "<td>
       <a href='update_html.php?id={$row['id']}&names={$row['name']}&pass={$row['pass']}'>修改</a>
    <a href='delete.php?id={$row['id']}'>删除</a></td>";
    echo "</tr>";
}
echo "</table>";